package ru.ifmo.metopt.abstracts;

/**
 * @author avhaliullin
 */
public abstract class AbstractFunction implements Function {

    @Override
    public double f(double... args) {
        if (dimensionality() != args.length) {
            throw new IllegalArgumentException("Function dim = " + dimensionality() + ". Point dim = " + args.length);
        }
        return safeF(args);
    }

    protected abstract double safeF(double... args);
}
